{% set pypi_name = 'oslo.log' %}
{% set upstream_version = upstream_version('4.4.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack log library
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('monotonic') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.context') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('pyinotify') }}
BuildRequires:  {{ py3('python-dateutil') }}
BuildRequires:  {{ py3('six') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
OpenStack logging configuration library provides standardized configuration
for all openstack projects.It also provides custom formatters, handlers and
support for context specific logging (like resource id's etc).

%package -n {{ py2name(py_versions='py3') }}
Summary:        OpenStack log library
Requires:       {{ py3('debtcollector') }}
Requires:       {{ py3('monotonic') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.context') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pyinotify') }}
Requires:       {{ py3('python-dateutil') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('systemd') }}
%if 0%{?suse_version}
Obsoletes:      {{ py2name(py_versions='py2') }} < 4.0.0
%endif

%description -n {{ py2name(py_versions='py3') }}
OpenStack logging configuration library provides standardized configuration
for all openstack projects.It also provides custom formatters, handlers and
support for context specific logging (like resource id's etc).

This package contains the Python 3.x module.

%package -n {{ py2name() }}-doc
Summary:        Documentation for OpenStack log library
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n {{ py2name() }}-doc
Documentation for the oslo.log library.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

# generate html docs
PYTHONPATH=. PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
python3 -m stestr.cli run

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%doc ChangeLog README.rst
%{python3_sitelib}/oslo_log
%{python3_sitelib}/*.egg-info
%{_bindir}/convert-json

%files -n {{ py2name() }}-doc
%license LICENSE
%doc doc/build/html

%changelog
